package nl.han.ica.ap.searchengine.client;

import nl.han.ica.ap.searchengine.client.searching.SearchStrategy;
import nl.han.ica.ap.searchengine.client.sorting.SortingStrategy;

/**
 * Main application controller / System facade
 * 
 * @author A.J. Janssen, ...
 * @version 0.1
 *
 */
public class Engine 
{
	private SearchStrategy searchStrategy;
	private SortingStrategy sortingStrategy;
	
	public Engine()
	{
		//TODO: Init default search/sort strategies
	}
	
	//Process a query
	public SearchResults processQuery(SearchQuery query)
	{
		SearchResults results = searchStrategy.process(query);
		sortingStrategy.sortResults(query, results);
		return results;
	}
	
	public void setSearchStrategy(SearchStrategy searchStrategy)
	{
		this.searchStrategy = searchStrategy;
	}
	
	public void setSortingStrategy(SortingStrategy sortingStrategy)
	{
		this.sortingStrategy = sortingStrategy;
	}
}
